{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=595
  Verdict: Accepted
}
uses SysUtils, Math;
 
const
	eps:extended=1e-9;
 
var
	i,n:longint;
	x,y,z,a,b,c,q:extended;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(x,y,z);
read(n);
for i:=1 to n do begin
	read(a,b,c,q);
	x:=x-a*q;
	y:=y-b*q;
	z:=z-c*q;
end;
if (x<eps) and (y<eps) and (z<eps) then write('YES') else 
	write('NO');
end.